/**
 * 
 */
package com.demo2do.wechatmcs.entity.token;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author downpour
 *
 */
public class Token {
    
    private String accessToken;
    
    /** timestamp */
    private long expire;

    /**
     * The default constructor
     */
    public Token() {
        
    }
    
    /**
     * @param accessToken
     * @param expireTime
     */
    public Token(String accessToken, Integer expireTime) {
        this.accessToken = accessToken;
        this.expire = System.currentTimeMillis() + ( (expireTime - 60) * 1000 );  // 
    }
    
    /**
     * 
     * @return
     */
    public Map<String, Object> descibe() {
        Map<String, Object> data = new LinkedHashMap<String, Object>();
        data.put("access_token", this.accessToken);
        data.put("expire", this.expire);
        return data;
    }

    /**
     * @return the accessToken
     */
    public String getAccessToken() {
        return this.accessToken;
    }

    /**
     * @return the expire
     */
    public long getExpire() {
        return this.expire;
    }

    /**
     * @param accessToken the accessToken to set
     */
    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    /**
     * @param expire the expire to set
     */
    public void setExpire(long expire) {
        this.expire = expire;
    }

}
